IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[cms_sp_SiteAdminMapDelete]') AND type in (N'P', N'PC'))
	DROP PROCEDURE [dbo].[cms_sp_SiteAdminMapDelete]
GO
create procedure [dbo].[cms_sp_SiteAdminMapDelete]
( @Id [int] )
as
DECLARE @NodeTreeId hierarchyid
SELECT @NodeTreeId = NodeTreeId FROM SiteAdminMaps WHERE SiteAdminMapId = @Id

DELETE FROM SiteAdminMaps
WHERE  NodeTreeId.IsDescendantOf(@NodeTreeId) = 1
GO